package edu.psu.collegerecommendationhelper.algorithm;

import static org.junit.Assert.*;

import org.junit.Test;

import edu.psu.collegerecommendationhelper.model.DemographicInfo;
import edu.psu.collegerecommendationhelper.model.EducationInfo;
import edu.psu.collegerecommendationhelper.model.PreferenceInfo;

import weka.core.Instances;


public class UserToClassifierTranslatorTest {

	
	@Test
	public void testTranslateData() {
		UserToClassifierTranslator xlate = new UserToClassifierTranslator();
		ClassifierData data = null;
		
		DemographicInfo demogrInfo = new DemographicInfo();
		EducationInfo edu = new EducationInfo();
		PreferenceInfo pref = new PreferenceInfo();
		
		demogrInfo.setState("NJ");
		demogrInfo.setRace("white");
		
		edu.setGPA((float) 3.0);
		edu.setCreadSAT((short) 600);
		
		pref.setPubpri("public");
		pref.setSize("1000");
		pref.setLocation("NJ");
		
		data = xlate.translateData(demogrInfo, edu, pref);
		assertNotNull("failed to translate data", data);
		
		assertEquals("answer false", 1, data.getWhiteRace());
		assertEquals("answer false", 1, data.getPublicPrivate());
		assertEquals("answer false", 1000, data.getTotalSize());
		assertEquals("answer false", 3.0, data.getHighschoolGPA(), 0.0);

	}

	@Test
	public void testCreateTestInstances() {
		Instances data = null;
		UserToClassifierTranslator xlate = new UserToClassifierTranslator();
		
		DemographicInfo demogrInfo = new DemographicInfo();
		EducationInfo edu = new EducationInfo();
		PreferenceInfo pref = new PreferenceInfo();
		
		demogrInfo.setState("NJ");
		demogrInfo.setRace("white");
		
		edu.setGPA((float) 3.0);
		edu.setCreadSAT((short) 600);
		
		pref.setPubpri("public");
		pref.setSize("1000");
		pref.setLocation("NJ");
		
		ClassifierData classData = xlate.translateData(demogrInfo, edu, pref);
		
		data = xlate.createTestInstances(classData);
		assertNotNull("failed to translate data", data);
	}

}
